package com.huangliusong.desigin.pattern.structual.facade;

/**
 * 礼物兑换服务🎁🎁
 * @author huangliusong
 * @since 2018/10/11
 * {@link }
 */
public class GiftExchangeService {
    private QualifyService qualifyService=new QualifyService();
    private PointsPaymentService pointsPaymentService=new PointsPaymentService();
    private ShippingService shippingService=new ShippingService();


    public void setQualifyService(QualifyService qualifyService) {
        this.qualifyService = qualifyService;
    }

    public void setPointsPaymentService(PointsPaymentService pointsPaymentService) {
        this.pointsPaymentService = pointsPaymentService;
    }

    public void setShippingService(ShippingService shippingService) {
        this.shippingService = shippingService;
    }

    public void giftExchange(PointsGift pointsGift){
        if (qualifyService.isAvailable(pointsGift)) {
            //资格校验通过
            if (pointsPaymentService.pay(pointsGift)){
                //如果支付积分陈工
                String shippingOrderNo=shippingService.shipGift(pointsGift);
                System.out.println("物流系统下单成功！订单号是："+shippingOrderNo);
            }
        }
    }
}
